using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using LiveExpo;
using System.Collections.Generic;
using Rss;

namespace LiveExpo.Activities
{
    [Designer(typeof(ConsoleActivityDesigner), typeof(IDesigner))]
    [ToolboxBitmap(typeof(GetListingsByCategoryKeywordLocation), "Resources.Custom Activity Background - Live Expo.jpg")]
    public partial class GetListingsByCategoryKeywordLocation: Activity
	{
		public GetListingsByCategoryKeywordLocation()
		{
			InitializeComponent();
		}



        public static DependencyProperty SiteIDProperty = System.Workflow.ComponentModel.DependencyProperty.Register("SiteID", typeof(int), typeof(GetListingsByCategoryKeywordLocation));

        [Description("This is the site you wish to query against. ")]
        [Category("Miscellaneous")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public int SiteID
        {
            get
            {
                return ((int)(base.GetValue(GetListingsByCategoryKeywordLocation.SiteIDProperty)));
            }
            set
            {
                base.SetValue(GetListingsByCategoryKeywordLocation.SiteIDProperty, value);
            }
        }

        public static DependencyProperty ApplicationKeyProperty = System.Workflow.ComponentModel.DependencyProperty.Register("ApplicationKey", typeof(string), typeof(GetListingsByCategoryKeywordLocation));

        [Description("This is the Application Key for your application, provided by LiveExpo. ")]
        [Category("Miscellaneous")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public string ApplicationKey
        {
            get
            {
                return ((string)(base.GetValue(GetListingsByCategoryKeywordLocation.ApplicationKeyProperty)));
            }
            set
            {
                base.SetValue(GetListingsByCategoryKeywordLocation.ApplicationKeyProperty, value);
            }
        }





        public static DependencyProperty PageProperty = System.Workflow.ComponentModel.DependencyProperty.Register("Page", typeof(int), typeof(GetListingsByCategoryKeywordLocation));

        [Description("Page number. ")]
        [Category("Miscellaneous")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public int Page
        {
            get
            {
                return (int)(base.GetValue(GetListingsByCategoryKeywordLocation.PageProperty));
            }
            set
            {
                base.SetValue(GetListingsByCategoryKeywordLocation.PageProperty, value);
            }
        }
        public static DependencyProperty PageSizeProperty = System.Workflow.ComponentModel.DependencyProperty.Register("PageSize", typeof(int), typeof(GetListingsByCategoryKeywordLocation));

            [Description("Listings per page. ")]
            [Category("Miscellaneous")]
            [Browsable(true)]
            [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
            public int PageSize
            {
                get
            {
                return (int)(base.GetValue(GetListingsByCategoryKeywordLocation.PageSizeProperty));
            }
            set
            {
                base.SetValue(GetListingsByCategoryKeywordLocation.PageSizeProperty, value);
            }
        }


                public static DependencyProperty OrderByProperty = System.Workflow.ComponentModel.DependencyProperty.Register("OrderBy", typeof(string), typeof(GetListingsByCategoryKeywordLocation));

                [Description("One of CreatedDate,Price,Distance,EventStartDate ")]
                [Category("Miscellaneous")]
                [Browsable(true)]
                [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
                public string OrderBy
                {
                    get
            {
                return (string)(base.GetValue(GetListingsByCategoryKeywordLocation.OrderByProperty));
            }
            set
            {
                base.SetValue(GetListingsByCategoryKeywordLocation.OrderByProperty, value);
            }
        }
        public static DependencyProperty OrderAscendingProperty = System.Workflow.ComponentModel.DependencyProperty.Register("OrderAscending", typeof(bool), typeof(GetListingsByCategoryKeywordLocation));

        [Description("Direction of ordering. ")]
        [Category("Miscellaneous")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public bool OrderAscending
        {
            get
            {
                return (bool)(base.GetValue(GetListingsByCategoryKeywordLocation.OrderAscendingProperty));
            }
            set
            {
                base.SetValue(GetListingsByCategoryKeywordLocation.OrderAscendingProperty, value);
            }
        }

        public static DependencyProperty CategoryProperty = System.Workflow.ComponentModel.DependencyProperty.Register("Category", typeof(int), typeof(GetListingsByCategoryKeywordLocation));

        [Description("This is the Application Key for your application, provided by LiveExpo. ")]
        [Category("Miscellaneous")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public int Category
        {
            get
            {
                return ((int)(base.GetValue(GetListingsByCategoryKeywordLocation.CategoryProperty)));
            }
            set
            {
                base.SetValue(GetListingsByCategoryKeywordLocation.CategoryProperty, value);
            }
        }

        public static DependencyProperty KeywordProperty = System.Workflow.ComponentModel.DependencyProperty.Register("Keyword", typeof(string), typeof(GetListingsByCategoryKeywordLocation));

        [Description("This is the Application Key for your application, provided by LiveExpo. ")]
        [Category("Miscellaneous")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public string Keyword
        {
            get
            {
                return ((string)(base.GetValue(GetListingsByCategoryKeywordLocation.KeywordProperty)));
            }
            set
            {
                base.SetValue(GetListingsByCategoryKeywordLocation.KeywordProperty, value);
            }
        }


        public static DependencyProperty LatitudeProperty = System.Workflow.ComponentModel.DependencyProperty.Register("Latitude", typeof(double), typeof(GetListingsByCategoryKeywordLocation));
        [Description("This is the latitude around which to search. ")]
        [Category("Miscellaneous")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public double Latitude
        {
            get
            {
                return ((double)(base.GetValue(GetListingsByCategoryKeywordLocation.LatitudeProperty)));
            }
            set
            {
                base.SetValue(GetListingsByCategoryKeywordLocation.LatitudeProperty, value);
            }
        }

        public static DependencyProperty LongitudeProperty = System.Workflow.ComponentModel.DependencyProperty.Register("Longitude", typeof(double), typeof(GetListingsByCategoryKeywordLocation));
        [Description("This is the latitude around which to search. ")]
        [Category("Miscellaneous")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public double Longitude
        {
            get
            {
                return ((double)(base.GetValue(GetListingsByCategoryKeywordLocation.LongitudeProperty)));
            }
            set
            {
                base.SetValue(GetListingsByCategoryKeywordLocation.LongitudeProperty, value);
            }
        }

        public static DependencyProperty MaxDistanceProperty = System.Workflow.ComponentModel.DependencyProperty.Register("MaxDistance", typeof(float), typeof(GetListingsByCategoryKeywordLocation));
        [Description("This is the maximum distance (in miles) to return listings. ")]
        [Category("Miscellaneous")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public float MaxDistance
        {
            get
            {
                return ((float)(base.GetValue(GetListingsByCategoryKeywordLocation.MaxDistanceProperty)));
            }
            set
            {
                base.SetValue(GetListingsByCategoryKeywordLocation.MaxDistanceProperty, value);
            }
        }

        public static DependencyProperty ResultProperty = System.Workflow.ComponentModel.DependencyProperty.Register("Result", typeof(RssFeed), typeof(GetListingsByCategoryKeywordLocation));

        [Description("This is a set of listings that meet the search criteria. ")]
        [Category("Result")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public RssFeed Result
        {
            get
            {
                return ((RssFeed)(base.GetValue(GetListingsByCategoryKeywordLocation.ResultProperty)));
            }
            set
            {
                base.SetValue(GetListingsByCategoryKeywordLocation.ResultProperty, value);
            }
        }

        
        
        
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {



            //
            // NOTE: Use static method to trigger system to start up
            //

            LiveExpoProxy proxy = new LiveExpoProxy();
            Result = proxy.GetListingsByCategoryKeywordLocation(SiteID, ApplicationKey, Page, PageSize, OrderBy, OrderAscending,Category,Keyword,Latitude, Longitude, MaxDistance);


            return base.Execute(executionContext);

        }
    
    }
}
